import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './css/style.css'
import './plugins/element.js'

import axios from 'axios'
Vue.config.productionTip = false
Vue.prototype.$http = axios
//请求的根路径
axios.defaults.baseURL='http://localhost:8101/exam/api/sys/'

//响应拦截器
axios.interceptors.response.use((ret)=>{
  return ret;
},(err)=>{console.log(err)})

        //请求拦截,头部加一个 token信息
        axios.interceptors.request.use((config)=>{
          const tk=localStorage.getItem('token')
          config.headers.Authorization=tk
          return config;//放行拦截器
      })

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
